<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title></title>
 <#include "/header.ftl">
</head>
<body>
<div id="app">
    <h1>视频点播</h1>
    <el-table :data="tableData" style="width: 100%">
        <el-table-column type="index" label="序号">
        </el-table-column>
        <el-table-column prop="partId" label="小节编号">
        </el-table-column>
        <el-table-column label="视频点播">
            <template slot-scope="scope">
                <el-button type="text" @click.native="getVideo(scope.$index,scope.row)" size="medium ">
                    {{scope.row.partIdName}}
                </el-button>
            </template>
        </el-table-column>
        <el-table-column prop="partFrequence" label="访问次数"></el-table-column>
    </el-table>
    <div class="block">
        <el-pagination
                @current-change="handleCurrentChange"
                :current-page.sync="pageIndex"
                :page-size="pageSize"
                layout="prev, pager, next, jumper"
                :total="total">
        </el-pagination>
    </div>
</div>
<#include "/footer.ftl">
<script>
    let _this = new Vue({
        el: '#app',
        data: {
            pageIndex: 1,
            pageSize: 2,
            total: 50,
            tableData: [],
        },
        created: function () {
            this.getPartMsg();
        },
        methods: {
            getVideo: function (index, row) {
                console.log(index)
                console.log(row)
                location.href='/video?videoId='+row.videoId;
                // this.$router.push({name: '点播视频', path: '/video', params: {videoId: row.videoId}});
            },
            // this.$route.params.sectionId
            getPartMsg: function () {
                $.ajax({
                    type: 'post',
                    url: '/api/student/getPartSectionBySectionId',
                    data: {
                        pageIndex: this.pageIndex,
                        sectionId: 1
                    },
                    dataType: 'json',
                    success: function (res) {
                        _this.pageSize = res.resData.pageSize;
                        _this.total = res.resData.total;
                        _this.tableData = res.resData.list;
                    },
                    error: function (error) {
                        console.log('接口不通' + error);
                    }
                })
            },
            handleCurrentChange(val) {
                this.pageIndex = val;
                this.getPartMsg();
            }
        }
    })

</script>
</body>
</html>
